/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * laser_requisicion_agregar.java
 *
 * Created on 28/11/2011, 12:27:30 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.*;
import java.text.ParseException;
/**
 *
 * @author Michelle
 */
public class laser_requisicion_agregar extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo_maquilla;

    private bd_conexion x = new bd_conexion() ;
       //se creaa la variable resultset
    private ResultSet rs = null;
    int controlcombo=0;


    /** Creates new form laser_requisicion_agregar */
    public laser_requisicion_agregar() {
        this.iniciar_modelo_de_tabla();

        initComponents();
        this.loadcomtiposmaquila();
        
        java.util.Date fechahoya=new Date();
        this.jdc_fechadocto.setDate(fechahoya);
        jtb_insumos.getColumnModel().getColumn(0).setPreferredWidth(30);//Cantidad
        jtb_insumos.getColumnModel().getColumn(1).setPreferredWidth(50);//Clave
        jtb_insumos.getColumnModel().getColumn(2).setPreferredWidth(60);//Descripcion
        jtb_insumos.getColumnModel().getColumn(3).setPreferredWidth(40);//altura de patron.
        jtb_insumos.getColumnModel().getColumn(4).setPreferredWidth(40);//ancho de patron
        jtb_insumos.getColumnModel().getColumn(5).setPreferredWidth(40);//ancho de tela
        jtb_insumos.getColumnModel().getColumn(6).setPreferredWidth(40);//ancho de corte
        jtb_insumos.getColumnModel().getColumn(7).setPreferredWidth(40);//Uso de Tela
        jtb_insumos.getColumnModel().getColumn(8).setPreferredWidth(40);//Piezas X linea
        jtb_insumos.getColumnModel().getColumn(9).setPreferredWidth(20);//Filas
        jtb_insumos.getColumnModel().getColumn(10).setPreferredWidth(35);//Total de Piezas
        jtb_insumos.getColumnModel().getColumn(11).setPreferredWidth(20);//Sobrante.
        jtb_insumos.getColumnModel().getColumn(12).setPreferredWidth(20);//Piezas X paquete
        jtb_insumos.getColumnModel().getColumn(13).setPreferredWidth(20);//Piezas X paquete
        jtb_insumos.getColumnModel().getColumn(14).setPreferredWidth(20);//Piezas x linea.
        jtb_insumos.getColumnModel().getColumn(15).setPreferredWidth(40);//Observaciones.
        this.jdc_fechadocto.requestFocus();
    }


private void iniciar_modelo_de_tabla()
    {
        jtable_modelo_maquilla=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_maquilla.addColumn("<html><b>cant.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Anc.Pat</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Alt.Pat</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Anc.Tela</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Anc.Corte</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Uso Tela</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>PzasXLinea</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Filas</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>T. Pzas</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Sob.</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Paq</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>No Paq</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Pz x Linea</b></html>");
        jtable_modelo_maquilla.addColumn("<html><b>Observaciones</b></html>");

    }

private void loadcomtiposmaquila()
    {
            this.jcmbx_tipmaquila.addItem("0"+":"+"ELEGIR TIPO MAQUILA");
            try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_laser_artic_insumosentrada_doctos_tipomaquila() as (id smallint,descrip text,observa text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_tipmaquila.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }


private void articulo_agregar(String idinsu,String cantidad)
    {
    String piezasxfilas[]=null,totfilass[]=null,alturausadas[]=null,puentedetexto="",puentefnece="",totalmatusado[]=null;
    Object[] fnewRow = new Object[16];
    float piezasxfila=0,totfilas=0,alturausada=0,filaajuste=0,filasneceenteras=0,piezascalculadas=0,totalusado=0;
    if(JOptionPane.showConfirmDialog(null, "<html><b><h3>Articulo="+this.jtf_idinsumo.getText()+" Piezas:"+this.jtf_canpzaingresa.getText()+"</h3></b> Desea Agregar este Articulo?</html>")==0)
         {
            DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
            DecimalFormat miformatusado = new DecimalFormat("###,###,###,###");

            int controlfolio=0;
                    String texto="select * from x1distribucion_laser_artic_insumos_insert('"+idinsu.toUpperCase().trim()+"','',1,'"+this.jtf_insumodescripcion.getText().trim().toUpperCase().replace(",", "")+"','"+this.jtf_item.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"',1,'0','0','0','0','',"+this.jtf_anchopieza.getText().trim()+","+this.jtf_altodepieza.getText().trim()+",0,0,0,0,0,'',0,0,'','','') as (idinsumo character varying(16),descripcion character varying(80),item character varying(16),unidad character varying(3),factor numeric,smin numeric,smax numeric,precio numeric);";
                    System.out.println(texto);
                    rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                    try {
                        while (rs.next())
                            {
                                    filaajuste=0;
                                    controlfolio=1;
                                    JOptionPane.showMessageDialog(null,"Articulo Agregado Correctamente", "Sistema Integral(Agregar Articulo) : Confirmacion",1);
                                     piezasxfila=Float.parseFloat(this.jtf_anchomaterial.getText())/rs.getFloat("smin");
                                    //System.out.println(piezasxfila);
                                    puentedetexto=miformat.format(piezasxfila).replace(".", ":").replace(",", ":");
                                    piezasxfilas=puentedetexto.split(":");
                                    System.out.println(piezasxfila);
                                    System.out.println(piezasxfilas[0]);
                                    totfilas=Float.parseFloat(cantidad)/Float.parseFloat(piezasxfilas[0]);
                                    puentefnece=miformat.format(totfilas).replace(".", ":").replace(",", ":");
                                    totfilass=puentefnece.split(":");
                                    filasneceenteras=Float.parseFloat(totfilass[0]);
                                    if (totfilas>filasneceenteras)
                                        {
                                            filaajuste=1;
                                        }
                                    puentefnece=miformat.format(Float.parseFloat(totfilass[0])+filaajuste);
                                    alturausada=Float.parseFloat(puentefnece)*rs.getFloat("smax");
                                    piezascalculadas=Float.parseFloat(piezasxfilas[0])*Float.parseFloat(puentefnece);
                                    //System.out.println(alturausada);
                                    fnewRow[0]=cantidad;
                                    fnewRow[1]=rs.getString ("idinsumo");
                                    fnewRow[2]=rs.getString ("descripcion").replace(",", "").replace("{", "").replace("}", "");
                                    fnewRow[3]=rs.getString ("smin");
                                    fnewRow[4]=rs.getString ("smax");
                                    fnewRow[5]=this.jtf_anchomaterial.getText();
                                    fnewRow[6]=miformat.format(Float.parseFloat(piezasxfilas[0])*rs.getFloat("smin"));
                                    fnewRow[7]=miformat.format(alturausada)+"="+miformat.format(alturausada/100)+"MT";
                                    fnewRow[8]=piezasxfilas[0];
                                    fnewRow[9]=puentefnece;
                                    fnewRow[10]=miformat.format(piezascalculadas);
                                    fnewRow[11]=miformat.format(piezascalculadas-Float.parseFloat(cantidad));
                                    fnewRow[12]=this.jtf_canpzasxPaquete.getText();
                                    fnewRow[13]=miformat.format(Float.parseFloat(cantidad)/Float.parseFloat(this.jtf_canpzasxPaquete.getText()))+"Paq";
                                    fnewRow[14]=miformat.format(Float.parseFloat(piezasxfilas[0])/2);
                                    fnewRow[15]=this.jtf_observacionesxpartida.getText()+".";
                                    jtable_modelo_maquilla.addRow(fnewRow);
                                    this.jtf_idinsumo.setText("");
                                    this.jtf_insumodescripcion.setText("");
                                    this.jtf_item.setText("");
                                    this.jtf_observacionesxpartida.setText("");
                                    this.jtf_canpzaingresa.requestFocus();
                                    totalmatusado=this.jtf_materialusado.getText().split("=");
                                    this.jtf_materialusado.setText(miformatusado.format(Float.parseFloat(totalmatusado[0].replace(",", "").replace(".",""))+alturausada)+"="+miformat.format((Float.parseFloat(totalmatusado[0].replace(",", "").replace(".",""))+alturausada)/100)+"MT");
                            }
                    } catch(Exception e)
                        {
                              System.out.println(e.getMessage());
                              JOptionPane.showMessageDialog(null,"Error conexion", "Sistema Integral(Integral) : Error",1);
                        }
                    if (controlfolio == 0 )
                            {
                                        JOptionPane.showMessageDialog(null,"Error Verifique Articulo", "Sistema Integral(Agregar Insumo) : Error",1);
                            }
                    else
                            {
                                this.calcularimportes();
                            }


        }
    }

private void documento_guardar()
    {
        ResultSet rs = null;
        float cantidad=0;
        int nobjetotabla=this.jtb_insumos.getRowCount();
        int fi=0,controlfolio=0;
        String cadenafilas="{'", arreglo_articulos[]=null;
        JPasswordField pwd = new JPasswordField(10);
        int numerofilas=this.jtable_modelo_maquilla.getRowCount();
         String punto="",comas="",imagen="";

             for(int i = 0 ;i < numerofilas; i++)
                {

                      comas=jtable_modelo_maquilla.getValueAt(i, 15).toString().replace(",", " ");
                      jtable_modelo_maquilla.setValueAt(comas, i,15);

                      punto=jtable_modelo_maquilla.getValueAt(i, 15).toString().replace(".", "")+".";
                      jtable_modelo_maquilla.setValueAt(punto, i,15);

                      comas=jtable_modelo_maquilla.getValueAt(i, 7).toString().replace(",", "");
                      jtable_modelo_maquilla.setValueAt(comas, i,7);

                      comas=jtable_modelo_maquilla.getValueAt(i, 10).toString().replace(",", "");
                      jtable_modelo_maquilla.setValueAt(comas, i,10);
                }
        //this.quitarfotosestereporte();
        //lanso la confirmacion de password
               for(fi=0;fi<nobjetotabla;fi++)
                {
                    try {
                        cantidad = Float.valueOf(this.jtb_insumos.getValueAt(fi, 3).toString()).floatValue();
                    } catch (NumberFormatException nfe) {
                        cantidad=0;
                    }
                    // System.out.println("cachar error"+cadenafilas);
                    if (cantidad > 0) {
                        cadenafilas+=""+this.jtb_insumos.getValueAt(fi, 3).toString()+":"+this.jtb_insumos.getValueAt(fi, 0).toString()+":"+this.jtb_insumos.getValueAt(fi, 4)+""+"\n";
                    }
                }//fin del for

                //System.out.println(s);
                //arreglo_articulos=cadenafilas.split(":");

                if(JOptionPane.showConfirmDialog(null, "Documento sera Guardado. Estan correcto sus Datos?")==0)
                    {

                    //this.quitardescripcion();
                    java.util.Vector arreglodearticulos=this.jtable_modelo_maquilla.getDataVector();

                    String articulos_papostgresql=arreglodearticulos.toString();
                    articulos_papostgresql=articulos_papostgresql.replace('[','{');
                    articulos_papostgresql=articulos_papostgresql.replace(']','}');
                    articulos_papostgresql=articulos_papostgresql.replace("null",".");


                    String arreglo_clie=this.jtf_idcliente.getText();
                    //String arreglo_depa[]=this.jcmbx_depa.getSelectedItem().toString().split(":");
                    //String arreglo_alma[]=this.jcmbx_almacenes.getSelectedItem().toString().split(":");
                    String arreglo_tipoinsu[]=this.jcmbx_tipmaquila.getSelectedItem().toString().split(":");

                    String texto="select * from x1distribucion_laser_artic_insumosrequi_doctos_insert('"+arreglo_clie+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','"+this.jtf_observaciones.getText().toUpperCase().replace(",", "").replace("]", "").replace("[", "").replace("{", "").replace("}", "")+"','"+arreglo_tipoinsu[0]+"','"+articulos_papostgresql+"')";
                    System.out.println(texto);
                    rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                    try {
                        while (rs.next()) {
                            controlfolio=rs.getInt(1);
                            if (rs.getInt(1) > 0) {
                                JOptionPane.showMessageDialog(null,"Documento "+controlfolio+"Correcto, Gracias", "Sistema Integral(Corte Laser) : Confirmacion",1);
                                this.imprimir(0,3,controlfolio);
                                this.Limpiar();

                            } else {
                                JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(Corte Laser) : Error",1);
                            }
                        }

                    } catch(Exception e) {
                        System.out.println(e.getMessage());
                        JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Corte Laser) : Error",1);
                    }


                    //this.btn_guardar.setVisible(false);
                }//fin del if qu confirmo guardar diferencia


    }


private void articulo_buscar(int opcion,String textobus,String cantidad)
{
    DecimalFormat miformat = new DecimalFormat("############.##");
    int controlfolio=0;
    String piezasxfilas[]=null,totfilass[]=null,alturausadas[]=null,puentedetexto="",puentefnece="";
    float piezasxfila=0,totfilas=0,alturausada=0,filaajuste=0,filasneceenteras=0,piezascalculadas=0;
    String texto="select * from x1distribucion_laser_artic_insumos_busqueda("+opcion+",'"+textobus.toUpperCase().trim()+"') as (id character varying(16),descripcion character varying(16),itemprov character varying(16),unidad character varying(3),factor numeric,smin numeric,smax numeric,precio numeric);";
    Object[] fnewRow = new Object[14];
    System.out.println(texto);
                    try {
                        rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                            {
                                    controlfolio=1;
                                    piezasxfila=Float.parseFloat(this.jtf_anchomaterial.getText())/rs.getFloat("smin");
                                    //System.out.println(piezasxfila);
                                    puentedetexto=miformat.format(piezasxfila).replace(".", ":").replace(",", ":");
                                    piezasxfilas=puentedetexto.split(":");
                                    System.out.println(piezasxfila);
                                    System.out.println(piezasxfilas[0]);
                                    this.jtf_Piezasxlinea.setText(miformat.format(Float.parseFloat(piezasxfilas[0])));
                                    this.jtf_idinsumo.setText(rs.getString ("id"));
                                    this.jtf_insumodescripcion.setText(rs.getString ("descripcion"));
                                    this.jtf_item.setText(rs.getString ("itemprov"));
                                    this.jtf_anchopieza.setText(rs.getString ("smin"));
                                    this.jtf_altodepieza.setText(rs.getString ("smax"));
                                    this.jtf_canpzaingresa.setText(miformat.format(Float.parseFloat(piezasxfilas[0])));
                                   
                            }
                        }
                    catch(Exception e)
                        {
                              System.out.println(e.getMessage());
                              JOptionPane.showMessageDialog(null,"Error conexion", "Sistema Integral(Integral) : Error",1);
                        }
                    if (controlfolio == 0 )
                            {
                                        //JOptionPane.showMessageDialog(null,"Error Verifique Articulo", "Sistema Integral(Agregar Insumo) : Error",1);
                                        this.jlbl_mensajeidinsumo.setText("!Nuevo! Ingrese datos");
                                        this.jtf_canpzaingresa.requestFocus();

                            }
                    else
                            {
                                
                                this.jlbl_mensajeidinsumo.setText("");
                                this.jtf_Piezasxlinea.requestFocus();
                            }
}


private void calcularimportes()
    {
    int numerofilas=this.jtable_modelo_maquilla.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,piezamaqui=0;
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtb_insumos.getValueAt(i, 0).toString()).floatValue();
                             piezasindi+=cantidad;
                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      
                }
    this.jtf_cantidadpiezas.setText(String.valueOf(piezasindi));
    }
private void Limpiar()
    {

    while(jtable_modelo_maquilla.getRowCount()>0)jtable_modelo_maquilla.removeRow(0);
    
    this.jcmbx_tipmaquila.setSelectedIndex(0);
    this.jtf_observaciones.setText("");
    this.jtf_canpzaingresa.setText("0");
    this.jtf_idinsumo.setText("");

    this.jtf_insumodescripcion.setText("");
    this.jtf_item.setText("");
    this.jtf_cantidadpiezas.setText("0");
    this.jtf_materialusado.setText("0=0");
    this.jcmbx_tipmaquila.requestFocus();
    }



 private void imprimir(int pag,float ptotal,int folio)
    {

     java.util.Date fechahoya=new Date();

     this.objimpresora=new laser_entradas_imprimir();

     this.objimpresora.setOneItem_cadenas_a_imprimir("Maquila Insumos");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.fechaeuropea(this.jdc_fechadocto.getDate())+" "+this.jdc_fechadocto.getDate().getHours()+":"+this.jdc_fechadocto.getDate().getMinutes());
     this.objimpresora.setOneItem_cadenas_a_imprimir("Folio:"+folio+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Status Documento:"+"EN PROCESO"+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Cliente o Tienda:"+this.jtf_idcliente.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Observaciones:"+this.jtf_observaciones.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     //this.objimpresora.setOneItem_cadenas_a_imprimir("paginas:"+ pag + " de "+ptotal+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("ResponsabLe Produccion: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Empaco: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Recibio: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jtb_insumos);
     this.objimpresora.imprimir_all(3,pag);
    }


private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }
private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpn_encabezado = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jtf_observaciones = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jdc_fechadocto = new com.toedter.calendar.JDateChooser();
        jcmbx_tipmaquila = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jta_archivo = new javax.swing.JTextArea();
        jbtn_importar = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        jtf_idcliente = new javax.swing.JTextField();
        jtf_clientedescribe = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jtf_idinsumo = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jtf_insumodescripcion = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jtf_item = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jtf_unidadsal = new javax.swing.JTextField();
        jbtn_agregar = new javax.swing.JButton();
        jlbl_mensajeidinsumo = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jtf_canpzaingresa = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jtf_factor = new javax.swing.JTextField();
        jlbl_costo2 = new javax.swing.JLabel();
        jtf_anchopieza = new javax.swing.JTextField();
        jlbl_costo3 = new javax.swing.JLabel();
        jtf_altodepieza = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jtf_anchomaterial = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jtf_canpzasxPaquete = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jtf_Piezasxlinea = new javax.swing.JTextField();
        jtf_filas = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jtf_observacionesxpartida = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jbtn_guardar = new javax.swing.JButton();
        jbtn_salir = new javax.swing.JButton();
        jbtn_helpayudame = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jpn_cuerpo = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtb_insumos = new javax.swing.JTable()
        //{
            //  public boolean isCellEditable(int rowIndex, int mColIndex) {
                //    if (mColIndex < 3)
                //  return false;
                //else
                //return true;
                //}
            //}
        ;
        jLabel19 = new javax.swing.JLabel();
        jtf_cantidadpiezas = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jtf_materialusado = new javax.swing.JTextField();
        jchbx_eliminarfila = new javax.swing.JCheckBox();
        jchbx_veridinsumo = new javax.swing.JCheckBox();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();
        jmni_guardar = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jmni_limpiardetalle = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(laser_requisicion_agregar.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jpn_encabezado.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jpn_encabezado.border.title"))); // NOI18N
        jpn_encabezado.setName("jpn_encabezado"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jtf_observaciones.setName("jtf_observaciones"); // NOI18N
        jtf_observaciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_observacionesActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jdc_fechadocto.setDateFormatString(resourceMap.getString("jdc_fechadocto.dateFormatString")); // NOI18N
        jdc_fechadocto.setName("jdc_fechadocto"); // NOI18N

        jcmbx_tipmaquila.setName("jcmbx_tipmaquila"); // NOI18N
        jcmbx_tipmaquila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbx_tipmaquilaActionPerformed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jta_archivo.setColumns(20);
        jta_archivo.setRows(5);
        jta_archivo.setName("jta_archivo"); // NOI18N
        jScrollPane3.setViewportView(jta_archivo);

        jbtn_importar.setText(resourceMap.getString("jbtn_importar.text")); // NOI18N
        jbtn_importar.setName("jbtn_importar"); // NOI18N
        jbtn_importar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_importarActionPerformed(evt);
            }
        });

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jtf_idcliente.setText(resourceMap.getString("jtf_idcliente.text")); // NOI18N
        jtf_idcliente.setName("jtf_idcliente"); // NOI18N

        jtf_clientedescribe.setEditable(false);
        jtf_clientedescribe.setName("jtf_clientedescribe"); // NOI18N

        javax.swing.GroupLayout jpn_encabezadoLayout = new javax.swing.GroupLayout(jpn_encabezado);
        jpn_encabezado.setLayout(jpn_encabezadoLayout);
        jpn_encabezadoLayout.setHorizontalGroup(
            jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_idcliente, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_clientedescribe, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jcmbx_tipmaquila, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(18, 18, 18)
                        .addComponent(jtf_observaciones)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jbtn_importar)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(62, Short.MAX_VALUE))
        );
        jpn_encabezadoLayout.setVerticalGroup(
            jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                        .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3)
                                .addComponent(jcmbx_tipmaquila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel6)
                                .addComponent(jtf_idcliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jtf_clientedescribe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)))
                    .addGroup(jpn_encabezadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(jpn_encabezadoLayout.createSequentialGroup()
                            .addComponent(jLabel10)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbtn_importar))
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jtf_idinsumo.setToolTipText(resourceMap.getString("jtf_idinsumo.toolTipText")); // NOI18N
        jtf_idinsumo.setName("jtf_idinsumo"); // NOI18N
        jtf_idinsumo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_idinsumoActionPerformed(evt);
            }
        });

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jtf_insumodescripcion.setToolTipText(resourceMap.getString("jtf_insumodescripcion.toolTipText")); // NOI18N
        jtf_insumodescripcion.setName("jtf_insumodescripcion"); // NOI18N
        jtf_insumodescripcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_insumodescripcionActionPerformed(evt);
            }
        });

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jtf_item.setToolTipText(resourceMap.getString("jtf_item.toolTipText")); // NOI18N
        jtf_item.setName("jtf_item"); // NOI18N
        jtf_item.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_itemActionPerformed(evt);
            }
        });

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        jtf_unidadsal.setText(resourceMap.getString("jtf_unidadsal.text")); // NOI18N
        jtf_unidadsal.setName("jtf_unidadsal"); // NOI18N
        jtf_unidadsal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_unidadsalActionPerformed(evt);
            }
        });

        jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
        jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
        jbtn_agregar.setName("jbtn_agregar"); // NOI18N
        jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregarActionPerformed(evt);
            }
        });

        jlbl_mensajeidinsumo.setFont(resourceMap.getFont("jlbl_mensajeidinsumo.font")); // NOI18N
        jlbl_mensajeidinsumo.setText(resourceMap.getString("jlbl_mensajeidinsumo.text")); // NOI18N
        jlbl_mensajeidinsumo.setName("jlbl_mensajeidinsumo"); // NOI18N

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jtf_canpzaingresa.setText(resourceMap.getString("jtf_canpzaingresa.text")); // NOI18N
        jtf_canpzaingresa.setToolTipText(resourceMap.getString("jtf_canpzaingresa.toolTipText")); // NOI18N
        jtf_canpzaingresa.setName("jtf_canpzaingresa"); // NOI18N
        jtf_canpzaingresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_canpzaingresaActionPerformed(evt);
            }
        });

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        jtf_factor.setEditable(false);
        jtf_factor.setText(resourceMap.getString("jtf_factor.text")); // NOI18N
        jtf_factor.setName("jtf_factor"); // NOI18N

        jlbl_costo2.setText(resourceMap.getString("jlbl_costo2.text")); // NOI18N
        jlbl_costo2.setName("jlbl_costo2"); // NOI18N

        jtf_anchopieza.setName("jtf_anchopieza"); // NOI18N
        jtf_anchopieza.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_anchopiezaActionPerformed(evt);
            }
        });

        jlbl_costo3.setText(resourceMap.getString("jlbl_costo3.text")); // NOI18N
        jlbl_costo3.setName("jlbl_costo3"); // NOI18N

        jtf_altodepieza.setName("jtf_altodepieza"); // NOI18N
        jtf_altodepieza.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_altodepiezaActionPerformed(evt);
            }
        });

        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N

        jtf_anchomaterial.setText(resourceMap.getString("jtf_anchomaterial.text")); // NOI18N
        jtf_anchomaterial.setToolTipText(resourceMap.getString("jtf_anchomaterial.toolTipText")); // NOI18N
        jtf_anchomaterial.setName("jtf_anchomaterial"); // NOI18N
        jtf_anchomaterial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_anchomaterialActionPerformed(evt);
            }
        });

        jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
        jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
        jbtn_buscar.setName("jbtn_buscar"); // NOI18N
        jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscarActionPerformed(evt);
            }
        });

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jtf_canpzasxPaquete.setText(resourceMap.getString("jtf_canpzasxPaquete.text")); // NOI18N
        jtf_canpzasxPaquete.setToolTipText(resourceMap.getString("jtf_canpzasxPaquete.toolTipText")); // NOI18N
        jtf_canpzasxPaquete.setName("jtf_canpzasxPaquete"); // NOI18N
        jtf_canpzasxPaquete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_canpzasxPaqueteActionPerformed(evt);
            }
        });

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jtf_Piezasxlinea.setText(resourceMap.getString("jtf_Piezasxlinea.text")); // NOI18N
        jtf_Piezasxlinea.setToolTipText(resourceMap.getString("jtf_Piezasxlinea.toolTipText")); // NOI18N
        jtf_Piezasxlinea.setName("jtf_Piezasxlinea"); // NOI18N
        jtf_Piezasxlinea.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_PiezasxlineaActionPerformed(evt);
            }
        });

        jtf_filas.setText(resourceMap.getString("jtf_filas.text")); // NOI18N
        jtf_filas.setToolTipText(resourceMap.getString("jtf_filas.toolTipText")); // NOI18N
        jtf_filas.setName("jtf_filas"); // NOI18N
        jtf_filas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_filasActionPerformed(evt);
            }
        });

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jtf_observacionesxpartida.setText(resourceMap.getString("jtf_observacionesxpartida.text")); // NOI18N
        jtf_observacionesxpartida.setToolTipText(resourceMap.getString("jtf_observacionesxpartida.toolTipText")); // NOI18N
        jtf_observacionesxpartida.setName("jtf_observacionesxpartida"); // NOI18N
        jtf_observacionesxpartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_observacionesxpartidaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_item, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl_costo2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_anchopieza, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl_costo3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_altodepieza, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_factor, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtn_agregar))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jlbl_mensajeidinsumo)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jtf_anchomaterial, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jtf_idinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jbtn_buscar, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_Piezasxlinea, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_filas, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_canpzasxPaquete, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_observacionesxpartida, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_anchomaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14)
                        .addComponent(jtf_idinsumo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_buscar)
                        .addComponent(jLabel23)
                        .addComponent(jLabel7)
                        .addComponent(jtf_Piezasxlinea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(jtf_canpzasxPaquete, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel9)
                        .addComponent(jtf_observacionesxpartida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel8)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_filas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)
                        .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlbl_mensajeidinsumo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(jLabel15)
                    .addComponent(jtf_item, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_costo2)
                    .addComponent(jtf_anchopieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbl_costo3)
                    .addComponent(jtf_altodepieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel21)
                    .addComponent(jtf_factor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_agregar)
                    .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N

        jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
        jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
        jbtn_guardar.setName("jbtn_guardar"); // NOI18N
        jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardarActionPerformed(evt);
            }
        });

        jbtn_salir.setIcon(resourceMap.getIcon("jbtn_salir.icon")); // NOI18N
        jbtn_salir.setText(resourceMap.getString("jbtn_salir.text")); // NOI18N
        jbtn_salir.setName("jbtn_salir"); // NOI18N
        jbtn_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_salirActionPerformed(evt);
            }
        });

        jbtn_helpayudame.setIcon(resourceMap.getIcon("jbtn_helpayudame.icon")); // NOI18N
        jbtn_helpayudame.setText(resourceMap.getString("jbtn_helpayudame.text")); // NOI18N
        jbtn_helpayudame.setName("jbtn_helpayudame"); // NOI18N
        jbtn_helpayudame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_helpayudameActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jbtn_guardar)
                .addGap(105, 105, 105)
                .addComponent(jbtn_salir)
                .addGap(130, 130, 130)
                .addComponent(jbtn_helpayudame)
                .addContainerGap(511, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jbtn_helpayudame)
                .addComponent(jbtn_salir)
                .addComponent(jbtn_guardar))
        );

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jpn_cuerpo.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jpn_cuerpo.setName("jpn_cuerpo"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jtb_insumos.setModel(this.jtable_modelo_maquilla);
        jtb_insumos.setName("jtb_insumos"); // NOI18N
        jtb_insumos.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jtb_insumosPropertyChange(evt);
            }
        });
        jtb_insumos.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtb_insumosKeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(jtb_insumos);

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        jtf_cantidadpiezas.setEditable(false);
        jtf_cantidadpiezas.setName("jtf_cantidadpiezas"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jtf_materialusado.setEditable(false);
        jtf_materialusado.setText(resourceMap.getString("jtf_materialusado.text")); // NOI18N
        jtf_materialusado.setName("jtf_materialusado"); // NOI18N

        jchbx_eliminarfila.setText(resourceMap.getString("jchbx_eliminarfila.text")); // NOI18N
        jchbx_eliminarfila.setName("jchbx_eliminarfila"); // NOI18N
        jchbx_eliminarfila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_eliminarfilaActionPerformed(evt);
            }
        });

        jchbx_veridinsumo.setText(resourceMap.getString("jchbx_veridinsumo.text")); // NOI18N
        jchbx_veridinsumo.setName("jchbx_veridinsumo"); // NOI18N
        jchbx_veridinsumo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbx_veridinsumoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpn_cuerpoLayout = new javax.swing.GroupLayout(jpn_cuerpo);
        jpn_cuerpo.setLayout(jpn_cuerpoLayout);
        jpn_cuerpoLayout.setHorizontalGroup(
            jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_materialusado, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(38, 38, 38)
                        .addComponent(jchbx_eliminarfila)
                        .addGap(33, 33, 33)
                        .addComponent(jchbx_veridinsumo))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1029, Short.MAX_VALUE))
                .addContainerGap())
        );
        jpn_cuerpoLayout.setVerticalGroup(
            jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 383, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel19)
                        .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)
                        .addComponent(jtf_materialusado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jchbx_eliminarfila))
                    .addComponent(jchbx_veridinsumo))
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jpn_cuerpo.TabConstraints.tabTitle"), jpn_cuerpo); // NOI18N

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jmni_guardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
        jmni_guardar.setText(resourceMap.getString("jmni_guardar.text")); // NOI18N
        jmni_guardar.setName("jmni_guardar"); // NOI18N
        jmni_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_guardarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_guardar);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem1.setIcon(resourceMap.getIcon("jMenuItem1.icon")); // NOI18N
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jmni_limpiardetalle.setText(resourceMap.getString("jmni_limpiardetalle.text")); // NOI18N
        jmni_limpiardetalle.setName("jmni_limpiardetalle"); // NOI18N
        jmni_limpiardetalle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_limpiardetalleActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_limpiardetalle);

        jMenuBar1.add(jMenu2);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jpn_encabezado, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jpn_encabezado, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
    if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
            {
                 this.dispose();
            }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jtf_observacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observacionesActionPerformed
        // TODO add your handling code here:
        this.jtf_canpzaingresa.requestFocus();
}//GEN-LAST:event_jtf_observacionesActionPerformed

    private void jcmbx_tipmaquilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_tipmaquilaActionPerformed
        // TODO add your handling code here:
        //this.jtf_descuento.requestFocus();
}//GEN-LAST:event_jcmbx_tipmaquilaActionPerformed

    private void jtf_idinsumoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idinsumoActionPerformed
        // TODO add your handling code here:

       this.jbtn_buscarActionPerformed(evt);
}//GEN-LAST:event_jtf_idinsumoActionPerformed

    private void jtf_insumodescripcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_insumodescripcionActionPerformed
        // TODO add your handling code here:
        this.jtf_item.requestFocus();
}//GEN-LAST:event_jtf_insumodescripcionActionPerformed

    private void jtf_itemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_itemActionPerformed
        // TODO add your handling code here:

        this.jtf_anchopieza.requestFocus();
    }//GEN-LAST:event_jtf_itemActionPerformed

    private void jtf_unidadsalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_unidadsalActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregar.requestFocus();
}//GEN-LAST:event_jtf_unidadsalActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
        if ((this.jtf_idinsumo.getText().toString().length()>0) && (this.jtf_insumodescripcion.getText().toString().length()>2) && (this.jtf_item.getText().toString().length()>0) && (this.jtf_unidadsal.getText().toString().length()>0)) {
            String minu="",cantidadarreglo="",codigoi="";
            //minu=this.jtf_minutosaprox.getText();
            cantidadarreglo=this.jtf_canpzaingresa.getText();
            codigoi=this.jtf_idinsumo.getText();
            this.articulo_agregar(codigoi,cantidadarreglo);
            this.jtf_idinsumo.requestFocus();
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar los campos antes de Agregar el Articulo", "Sistema Integral(Agregar Articulo) : Error",1);
            this.jtf_idinsumo.requestFocus();
        }
}//GEN-LAST:event_jbtn_agregarActionPerformed

    private void jtf_canpzaingresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_canpzaingresaActionPerformed
        // TODO add your handling code here:
        DecimalFormat miformat = new DecimalFormat("############.##");        // TODO add your handling code here:
        this.jtf_filas.setText(miformat.format(Float.parseFloat(this.jtf_canpzaingresa.getText())/Float.parseFloat(this.jtf_Piezasxlinea.getText())));
        this.jtf_canpzasxPaquete.requestFocus();
        
}//GEN-LAST:event_jtf_canpzaingresaActionPerformed

    private void jtf_anchopiezaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_anchopiezaActionPerformed
        // TODO add your handling code here:
        this.jtf_altodepieza.requestFocus();
}//GEN-LAST:event_jtf_anchopiezaActionPerformed

    private void jtf_altodepiezaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_altodepiezaActionPerformed
        // TODO add your handling code here:
        this.jtf_unidadsal.requestFocus();
}//GEN-LAST:event_jtf_altodepiezaActionPerformed

    private void jtf_anchomaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_anchomaterialActionPerformed
        // TODO add your handling code here:
        this.jtf_idinsumo.requestFocus();
}//GEN-LAST:event_jtf_anchomaterialActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        String minu="",cantidadarreglo="",codigoi="";
        //minu=this.jtf_minutosaprox.getText();
        cantidadarreglo=this.jtf_canpzaingresa.getText();
        codigoi=this.jtf_idinsumo.getText();
        
        if (this.jtf_idinsumo.getText().length() >0)
            {
            if(JOptionPane.showConfirmDialog(null, "<html><b><h3>Articulo="+this.jtf_idinsumo.getText()+"</h3></b> Desea es Correcto?</html>")==0) {
                
                this.articulo_buscar(1, codigoi, cantidadarreglo);
                } else
                    {
                        this.jtf_canpzaingresa.requestFocus();
                    }
                }
        else
            {
                JOptionPane.showMessageDialog(null,"Favor de Verificar Precio y codigo", "Sistema Integral(Agregar Articulo) : Error",1);
            }

    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jtb_insumosPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_insumosPropertyChange
        // TODO add your handling code here:
        this.calcularimportes();
}//GEN-LAST:event_jtb_insumosPropertyChange

    private void jtb_insumosKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_insumosKeyPressed
        // TODO add your handling code here:
        System.out.println(evt.getKeyCode());
        System.out.println("Hola");
        if (evt.getKeyCode() == 10) {
            try {
                this.calcularimportes();
            } catch (Exception ex) {
                System.out.println("ERROR no ha elegido en el cuadro de texto");
            }

        }
}//GEN-LAST:event_jtb_insumosKeyPressed

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:
        float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
        int index=this.jcmbx_tipmaquila.getSelectedIndex();
        if ((index>0)  && (tpiezas>0))
            {
                this.documento_guardar();
                System.out.println("se guarda");
            }
        else
            {
                JOptionPane.showMessageDialog(null,"Favor de Verificar Folio Documento y Proveedor", "Sistema Integral(Agregar Articulo) : Error",1);
            }
}//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jbtn_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_salirActionPerformed
        // TODO add your handling code here:
        //x.cierraConexion();
        this.jmni_salirActionPerformed(evt);
}//GEN-LAST:event_jbtn_salirActionPerformed

    private void jbtn_helpayudameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_helpayudameActionPerformed
        // TODO add your handling code here:
        //  this.ayuda();
}//GEN-LAST:event_jbtn_helpayudameActionPerformed

    private void jtf_canpzasxPaqueteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_canpzasxPaqueteActionPerformed
        // TODO add your handling code here:
        this.jtf_observacionesxpartida.requestFocus();
        
}//GEN-LAST:event_jtf_canpzasxPaqueteActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jmni_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_guardarActionPerformed
        // TODO add your handling code here:
        this.jbtn_guardarActionPerformed(evt);
    }//GEN-LAST:event_jmni_guardarActionPerformed

    private void jtf_PiezasxlineaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_PiezasxlineaActionPerformed
        // TODO add your handling code here:
        this.jtf_filas.requestFocus();
}//GEN-LAST:event_jtf_PiezasxlineaActionPerformed

    private void jtf_filasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_filasActionPerformed
        DecimalFormat miformat = new DecimalFormat("############.####");        // TODO add your handling code here:
        this.jtf_canpzaingresa.setText(miformat.format(Float.parseFloat(this.jtf_Piezasxlinea.getText())*Float.parseFloat(this.jtf_filas.getText())));
        this.jtf_canpzaingresa.requestFocus();
}//GEN-LAST:event_jtf_filasActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregarActionPerformed(evt);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jbtn_importarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Importar Estos Articulos?")==0) {
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            for (int i=0;i<arreglo_importa.length;i++) {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.jtf_anchomaterial.setText(arreglo_codigo[0]);
                this.jtf_idinsumo.setText(arreglo_codigo[1]);
                this.jbtn_buscarActionPerformed(evt);
                this.jtf_canpzaingresa.setText(arreglo_codigo[2]);
                this.jtf_canpzasxPaquete.setText(arreglo_codigo[3]);
                this.jtf_observacionesxpartida.setText(arreglo_codigo[4]);
                this.jbtn_agregarActionPerformed(evt);
            }
            this.jta_archivo.setText("");
            this.jtf_canpzaingresa.setText("0");
            this.jtf_idinsumo.setText("");
            this.jtf_idinsumo.requestFocus();
        }
}//GEN-LAST:event_jbtn_importarActionPerformed

    private void jtf_observacionesxpartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observacionesxpartidaActionPerformed
        // TODO add your handling code here:
        this.jtf_insumodescripcion.requestFocus();
}//GEN-LAST:event_jtf_observacionesxpartidaActionPerformed

    private void jmni_limpiardetalleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_limpiardetalleActionPerformed
        // TODO add your handling code here:
    if(JOptionPane.showConfirmDialog(null, "Desea Limpiar Documento?")==0)
        {
            while(jtable_modelo_maquilla.getRowCount()>0)jtable_modelo_maquilla.removeRow(0);
            this.jtf_cantidadpiezas.setText("0");
            this.jtf_materialusado.setText("0=0");
        }

    }//GEN-LAST:event_jmni_limpiardetalleActionPerformed

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu2ActionPerformed

    private void jchbx_eliminarfilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_eliminarfilaActionPerformed
        // TODO add your handling code here:
        int fila = jtb_insumos.getSelectedRow();
        String altura[]=null,totalmatusado[]=null,piezastot="";
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.####");
        DecimalFormat miformatusado = new DecimalFormat("###,###,###,###");

        if(JOptionPane.showConfirmDialog(null, "Desea Eliminar Fila Seleccionada?")==0)
            {
                altura=this.jtable_modelo_maquilla.getValueAt(fila, 7).toString().split("=");
                piezastot=this.jtable_modelo_maquilla.getValueAt(fila, 0).toString();
                jtable_modelo_maquilla.removeRow(fila);
                totalmatusado=this.jtf_materialusado.getText().split("=");

                this.jtf_materialusado.setText(miformatusado.format(Float.parseFloat(totalmatusado[0].replace(",", "").replace(".",""))-Float.parseFloat(altura[0].replace(",", "")))+"="+miformat.format((Float.parseFloat(totalmatusado[0].replace(",", ""))-Float.parseFloat(altura[0].replace(",", "")))/100)+"MT");
                this.jtf_cantidadpiezas.setText(miformatusado.format(Float.parseFloat(this.jtf_cantidadpiezas.getText().replace(",", ""))-Float.parseFloat(piezastot.replace(",", ""))));
            }
    }//GEN-LAST:event_jchbx_eliminarfilaActionPerformed

    private void jchbx_veridinsumoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbx_veridinsumoActionPerformed
        // TODO add your handling code here:
        int fila = jtb_insumos.getSelectedRow();
        String codigo=this.jtable_modelo_maquilla.getValueAt(fila, 1).toString();
        laser_entradas_catalogo_patrones_detalle flecpd=new laser_entradas_catalogo_patrones_detalle(1,codigo,"");
        flecpd.pack();
        flecpd.setVisible(true);
}//GEN-LAST:event_jchbx_veridinsumoActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new laser_requisicion_agregar().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_helpayudame;
    private javax.swing.JButton jbtn_importar;
    private javax.swing.JButton jbtn_salir;
    private javax.swing.JCheckBox jchbx_eliminarfila;
    private javax.swing.JCheckBox jchbx_veridinsumo;
    private javax.swing.JComboBox jcmbx_tipmaquila;
    private com.toedter.calendar.JDateChooser jdc_fechadocto;
    private javax.swing.JLabel jlbl_costo2;
    private javax.swing.JLabel jlbl_costo3;
    private javax.swing.JLabel jlbl_mensajeidinsumo;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_guardar;
    private javax.swing.JMenuItem jmni_limpiardetalle;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JPanel jpn_cuerpo;
    private javax.swing.JPanel jpn_encabezado;
    private javax.swing.JTextArea jta_archivo;
    private javax.swing.JTable jtb_insumos;
    private javax.swing.JTextField jtf_Piezasxlinea;
    private javax.swing.JTextField jtf_altodepieza;
    private javax.swing.JTextField jtf_anchomaterial;
    private javax.swing.JTextField jtf_anchopieza;
    private javax.swing.JTextField jtf_canpzaingresa;
    private javax.swing.JTextField jtf_canpzasxPaquete;
    private javax.swing.JTextField jtf_cantidadpiezas;
    private javax.swing.JTextField jtf_clientedescribe;
    private javax.swing.JTextField jtf_factor;
    private javax.swing.JTextField jtf_filas;
    private javax.swing.JTextField jtf_idcliente;
    private javax.swing.JTextField jtf_idinsumo;
    private javax.swing.JTextField jtf_insumodescripcion;
    private javax.swing.JTextField jtf_item;
    private javax.swing.JTextField jtf_materialusado;
    private javax.swing.JTextField jtf_observaciones;
    private javax.swing.JTextField jtf_observacionesxpartida;
    private javax.swing.JTextField jtf_unidadsal;
    // End of variables declaration//GEN-END:variables
private laser_entradas_imprimir objimpresora;
}
